package com.xjt.sentinel.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpFilter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @program: spring-cloud-alibaba
 * @description:
 * @author: xujt
 * @date: 2022-05-10 09:59
 **/
@Configuration
public class MvcConfig extends HttpFilter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("使用过滤器");
        response.setCharacterEncoding(String.valueOf(StandardCharsets.UTF_8));
        super.doFilter(request, response, chain);
    }

}
